From 0ed6bf41be126e8a4f274de06545dbf4f3f883c2 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 22 Oct 2022 22:51:50 +0300 Subject: feat: support syntax highlighting --- src/pages/[...path].tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/pages/[...path].tsx') diff --git a/src/pages/[...path].tsx b/src/pages/[...path].tsx index 5bedae3..19dc42d 100644 --- a/src/pages/[...path].tsx +++ b/src/pages/[...path].tsx @@ -7,15 +7,18 @@ import Image from '../Image'; import emojiPlugin from '../emojiPlugin'; import remarkGemoji from 'remark-gemoji'; import benzinConfig from '../benzinConfig'; +import Code from '../Code'; const transformLinkUri = (uri: string): string => { return uri.match(/(.*)\.md/)?.[1] || uri; } +/* Image sources are relative to CDN root */ const transformImageUri = (uri: string): string => { return uri.startsWith('http') ? uri : benzinConfig.CDN + uri; } +/* Disable JavaScript in runtime */ export const config = { unstable_runtimeJS: false, }; @@ -27,7 +30,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => { ); const markdownSource = await benzinConfig.adapter.getMarkdownSource(benzinConfig.CDN, path); - const emojiFileNames = await benzinConfig.adapter.getEmojiFileNames(benzinConfig.CDN); + const emojiFileNames = await benzinConfig.adapter.getEmojiFileNames(benzinConfig.CDN, benzinConfig.emojiRootPath); return { props: { @@ -63,6 +66,7 @@ const Page: NextPage = ({ markdownSource, emojiFileNames }: any) => { components={{ emoji: Emoji, img: Image, + code: Code, h1: 'h2', h2: 'h3', h3: 'h4', -- cgit v1.2.3